Mathias Mamsch - Thu Jan 21 05:35:47 EST 2016
If you get an access violation your object handle is somehow corrupt. This can happen, if you save it to a skip list or variable and then delete it and later access it, or something. So please verify that you do not access invalid handles.
Next possible problem can be DOORS internal structure problems - in which case flushDeletions() and refresh (Module) might give you peace. Regards, Mathias
I have all this kind of stuff. But can not detect the problem. This happens when have recursion and try to delete the children of parent object. If I have 1.3 ->1.3.1 -->1.3.3 etc and have a lot of recursive calls on 14 or more. With small numbers there is no problem.
When execute it directly in the DXLeditor there was no such kind of problems .
void deleteObject(Module mod, int id, bool isSoftDeletion) {
printMessage (3, "Entering deleteObject function.\n")
printMessage (3, "Try to delete object with id:" (quote(id "")) "\n")
if (null id) error "The specified id null"
if (null mod) error "The specified module is null"
filtering off
Object o2BDeleted = null
Object o
for o in mod do {
int currentId = o."Absolute Number"
if currentId == id then {
o2BDeleted = o
break
}
}
if (null o2BDeleted){
error "No Object for deletion is found."
}
if (isSoftDeletion && isDeleted(o2BDeleted)) {
error "The object is already deleted."
}
if (!canDelete(o2BDeleted)) {
error "The object can not be deleted!!!"
}
// Delete outlinks because during deletion of the object an error can appears and
// then to lock the module.
printMessage (3, "Start deleting out-coming links. For the object with id:" (quote(id)"") "\n")
Skip sk = create()
Link L
for L in all o2BDeleted->"*" do put(sk, L,L)
for L in sk do delete L
flushDeletions()
printMessage (3, "Start deleting in-coming links. For the object with id:" (quote(id)"") "\n")
//Delete incomming links
LinkRef linkReferences
ModName_ srcModRef
for linkReferences in o2BDeleted<-"*" do {
srcModRef = source linkReferences
if (!(open srcModRef)) {
edit(fullName(srcModRef), false)
}
}
Link inLink
for inLink in o2BDeleted<-"*" do {
delete inLink
}
flushDeletions()
refresh mod
Object childObj
for childObj in all o2BDeleted do {
printMessage (3, "Start deleting child with id:" (quote(childObj."Absolute Number" "")) " of parent: "(quote(id)"") "\n")
if (cell o2BDeleted || row o2BDeleted || isDeleted o2BDeleted) {
printMessage (1, "Object is ignored from deletion it is sell or row in table:" (quote(id)"") "\n")
continue
}
int absNumber = childObj."Absolute Number"
deleteObject (mod, absNumber, isSoftDeletion)
}
flushDeletions()
refresh mod
if(leaf(o2BDeleted)) {
printMessage (3, "Check for descendents - id:" (quote(id ""))"\n")
if (isSoftDeletion) {
printMessage (3, "Execute softDelete on requirement with id:" (quote(id ""))"\n")
softDelete(o2BDeleted)
} elseif (isDeleted(o2BDeleted)) {
printMessage (3, "Execute purge on softDeleted object:" (quote(id ""))"\n")
purgeObject_ (o2BDeleted)
} else {
printMessage (3, "Executing hard deleting on object id:" (quote(o2BDeleted."Absolute Number" ""))"\n")
hardDelete(o2BDeleted)
}
flushDeletions()
} else {
printMessage (3, "Not leaf: id" (quote(o2BDeleted."Absolute Number" ""))"\n")
}
}